from django.utils.deprecation import MiddlewareMixin
from django.http import HttpResponse, JsonResponse

class AppMiddlewareMixin(MiddlewareMixin):
    error_message= {}
    state= True
        
    def error_update(self,k,v):
        self.error_message.update({k:v})
        self.state= False
    
    def process_request(self, request):
        self.state= False
        pass

    def process_response(self, request, response):
        self.state=True
        return response

    def process_exception(self, request, exception):
        pass

    def process_template_response(self, request, response):
        return response